@Service
	public class MenuServiceImpl implements MenuService
	{
		@Resource
		private  MenuMapper  menuMapper;
		@Override
		public int insertMenu(MenuParam param){
			Menu menu = new Menu();
			if(param.getModuleId() != 0){
				menu.setModuleId(param.getModuleId());
			}
			if(param.getMenuCode() != null){
				menu.setMenuCode(param.getMenuCode());
			}
			if(param.getMenuName() != null){
				menu.setMenuName(param.getMenuName());
			}
			if(param.getDescription() != null){
				menu.setDescription(param.getDescription());
			}
			if(param.getWebUrl() != null){
				menu.setWebUrl(param.getWebUrl());
			}
			if(param.getIconUrl() != null){
				menu.setIconUrl(param.getIconUrl());
			}
			if(param.getCreateTime() != null){
				menu.setCreateTime(param.getCreateTime());
			}
			if(param.getUpdateTime() != 0){
				menu.setUpdateTime(param.getUpdateTime());
			}
			 return menuMapper.insertSelective(menu);
		}
		@Override
		public int updateMenu(MenuEditParam param){
			Menu menu = new Menu();
			if(param.getMenuId() != null){
				menu = getMenu(Long.parseLong(param.getMenuId()));
			}
			if(menu == null){
				return 0;
			}
			if(param.getModuleId() != 0){
				menu.setModuleId(param.getModuleId());
			}
			if(param.getMenuCode() != null){
				menu.setMenuCode(param.getMenuCode());
			}
			if(param.getMenuName() != null){
				menu.setMenuName(param.getMenuName());
			}
			if(param.getDescription() != null){
				menu.setDescription(param.getDescription());
			}
			if(param.getWebUrl() != null){
				menu.setWebUrl(param.getWebUrl());
			}
			if(param.getIconUrl() != null){
				menu.setIconUrl(param.getIconUrl());
			}
			if(param.getCreateTime() != null){
				menu.setCreateTime(param.getCreateTime());
			}
			if(param.getUpdateTime() != 0){
				menu.setUpdateTime(param.getUpdateTime());
			}
			 return menuMapper.updateByPrimaryKeySelective(menu);
		}
		@Override
		public int deleteMenu(long id){
			Menu menu = getMenu(id);
			if(menu == null){
				return 0;
			}
			return menuMapper.deleteByPrimaryKey(id);
		}
		@Override
		public Menu getMenu(long id){
			 return menuMapper.selectByPrimaryKey(id);
		}
		@Override
		public int deleteMenuList(String ids){
			List<String> menuList = Arrays.asList(ids.split(","));
			int count = 0;
			for (String id : menuList) {
			count = count + deleteMenu(Long.parseLong(id));
		}
			if( count == menuList.size()){
			return 1;
			}else{
			return 0;
			}
	}
		@Override
		public List<Menu> selectMenu(MenuSelectParam param){
			MenuExample menuExample = new MenuExample();
			menuExample.setOrderByClause("create_time desc");
			MenuExample.Criteria criteria = menuExample.createCriteria();
			if(param.getModuleId() != 0){
				criteria.andModuleIdEqualTo(param.getModuleId());
			}
			if(param.getMenuCode() != null){
				criteria.andMenuCodeEqualTo(param.getMenuCode());
			}
			if(param.getMenuName() != null){
				criteria.andMenuNameEqualTo(param.getMenuName());
			}
			if(param.getDescription() != null){
				criteria.andDescriptionEqualTo(param.getDescription());
			}
			if(param.getWebUrl() != null){
				criteria.andWebUrlEqualTo(param.getWebUrl());
			}
			if(param.getIconUrl() != null){
				criteria.andIconUrlEqualTo(param.getIconUrl());
			}
			if(param.getCreateTime() != null){
				criteria.andCreateTimeEqualTo(param.getCreateTime());
			}
			if(param.getUpdateTime() != 0){
				criteria.andUpdateTimeEqualTo(param.getUpdateTime());
			}
			if (param.getOrder() != 0){
			}
			menuExample.setLimitStart((param.getPageIndex() - 1) * param.getPageSize());
			menuExample.setLimitEnd(param.getPageSize());
			List<Menu> menuList = menuMapper.selectByExample(menuExample);
			return menuList;
		}
		@Override
		public int countMenu(MenuSelectParam param){
			MenuExample menuExample = new MenuExample();
			menuExample.setOrderByClause("create_time desc");
			MenuExample.Criteria criteria = menuExample.createCriteria();
			if(param.getModuleId() != 0){
				criteria.andModuleIdEqualTo(param.getModuleId());
			}
			if(param.getMenuCode() != null){
				criteria.andMenuCodeEqualTo(param.getMenuCode());
			}
			if(param.getMenuName() != null){
				criteria.andMenuNameEqualTo(param.getMenuName());
			}
			if(param.getDescription() != null){
				criteria.andDescriptionEqualTo(param.getDescription());
			}
			if(param.getWebUrl() != null){
				criteria.andWebUrlEqualTo(param.getWebUrl());
			}
			if(param.getIconUrl() != null){
				criteria.andIconUrlEqualTo(param.getIconUrl());
			}
			if(param.getCreateTime() != null){
				criteria.andCreateTimeEqualTo(param.getCreateTime());
			}
			if(param.getUpdateTime() != 0){
				criteria.andUpdateTimeEqualTo(param.getUpdateTime());
			}
			if (param.getOrder() != 0){
			}
			menuExample.setLimitStart((param.getPageIndex() - 1) * param.getPageSize());
			menuExample.setLimitEnd(param.getPageSize());
			return menuMapper.countByExample(menuExample);
		}
}
